﻿using System;
using Framework;

namespace Enterprise.Admin.Handle.Technical
{
    public partial class Edit : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            object result;
            try
            {
                var id = Fq("CoTechnicalId").SafeToInt();
                var title = Fq("CoTitle").SafeToString();
                var content = Fq("CoContent").SafeToString();
                var summary = Fq("CoSummary").SafeToString();
                var author = Fq("CoAuthor").SafeToString();
                var language = Fq("CoLanguage").SafeToString();
                var isPopular = Fq("CoIsPopular").SafeToBool();
                var isTop = Fq("CoIsTop").SafeToBool();
                var isRecommend = Fq("CoIsRecommend").SafeToBool();
                var keyword = Fq("CoKeyword").SafeToString();
                var description = Fq("CoDescription").SafeToString();
                var sortValue = Fq("CoSort").SafeToInt();
                var technicalService = new TechnicalService();
                technicalService.Edit(id, title, summary, content, keyword, description, author, language, DateTime.Now, sortValue, isRecommend, isPopular, isTop);
                result = (new { state = true, message = "修改成功！" });
            }
            catch (Exception ex)
            {
                result = (new { state = false, message = ex.Message });
            }
            Json(result);
        }
    }
}